package com.my.chapter8;

public class practice7 {
    public static void main(String[] args) {
        Music3.main(args);
    }
}

class Instrument{
    void play(){
        System.out.println("Instrument.play()");
    }
    String what(){
        return "Instrument";
    }
    void adjust(){
        System.out.println("Adjusting Instrument");
    }
}

class Wind extends Instrument{
    void play(){
        System.out.println("Wind.play()");
    }
    String what(){
        return "Wind";
    }
    void adjust(){
        System.out.println("Adjusting Wind");
    }
}

class Percussion extends Instrument{
    void play(){
        System.out.println("Percussion.play()");
    }
    String what(){
        return "Percussion";
    }
    void adjust(){
        System.out.println("Adjusting Percussion");
    }
}

class Stringed extends Instrument{
    void play(){
        System.out.println("Stringed.play()");
    }
    String what(){
        return "Stringed";
    }
    void adjust(){
        System.out.println("Adjusting Stringed");
    }
}

class Brass extends Instrument{
    void play(){
        System.out.println("Brass.play()");
    }
    void adjust(){
        System.out.println("Adjusting Brass");
    }
}

class Guitar extends Instrument{
    void play(){
        System.out.println("Guitar.play()");
    }
    String what(){
        return "Guitar";
    }
    void adjust(){
        System.out.println("Adjusting Guitar");
    }
}

class Woodwind extends Wind{
    void play(){
        System.out.println("Woodwind.play()");
    }
    String what(){
        return "Woodwind";
    }
}

class Music3{
    public static void tune(Instrument i){
        i.play();
    }
    public static void tuneAll(Instrument[] e){
        for(Instrument i:e){
            tune(i);
        }
    }

    public static void main(String[] args) {
        Instrument[] orchestra = {
                new Wind(),
                new Percussion(),
                new Stringed(),
                new Brass(),
                new Guitar(),
                new Woodwind()
        };
        tuneAll(orchestra);
    }
}

